﻿namespace WinForms.ControlList.Popedom
{
    using Bll.Systems;
    using Model.Systems;
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Runtime.InteropServices;
    using System.Windows.Forms;
    using WinForms;
    using WinForms.Properties;

    public class FrmRolePopedom : Form
    {
        private Button btn_AllSelect;
        private Button btn_Close;
        private Button btn_Save;
        private IContainer components = null;
        private ConfigEnt config = null;
        protected ArrayList hash = new ArrayList();
        public const int HTCAPTION = 2;
        private Label lbl_TiShi2;
        private Label lblTitle;
        private ArrayList menuTable = new ArrayList();
        private Panel pan_AllPanel;
        private Panel pan_AllPlanes;
        private Panel pan_AllPope;
        private Panel pan_Bottoms;
        private Panel pan_Dock;
        private Panel pan_DockBottom;
        private Panel pan_DockLeft;
        private Panel pan_DockRight;
        private Panel pan_Lefts;
        private Panel pan_Rights;
        private Panel pan_Top;
        private Panel pan_TopLeft;
        private Panel pan_TopRight;
        private Panel pan_ZhongJian;
        private Panel pane_TopT;
        private Panel panel_Button;
        private Panel panel9;
        private ArrayList popeTable = new ArrayList();
        private ArrayList PopList = new ArrayList();
        private string RoleId = "";
        public const int SC_MOVE = 0xf010;
        private TabPage tab_Menu;
        private TabPage tab_Pope;
        private TabControl table_AllPople;
        public const int WM_SYSCOMMAND = 0x112;

        public FrmRolePopedom(string id)
        {
            this.InitializeComponent();
            base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            base.SetStyle(ControlStyles.UserPaint, true);
            base.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.config = ConfigBll.GetModel(1);
            this.RoleId = id;
            this.GetLoginRole();
            this.GetLoadPopedom();
            this.LoadMenu();
            this.LoadRolePople();
            base.KeyPreview = true;
            base.KeyDown += new KeyEventHandler(this.Form_KeyDown);
        }

        private void AllSelectCheck(Control parContainer)
        {
            for (int i = 0; i < parContainer.Controls.Count; i++)
            {
                if (parContainer.Controls[i].HasChildren)
                {
                    this.AllSelectCheck(parContainer.Controls[i]);
                }
                else if (parContainer.Controls[i].GetType().Name == "CheckBox")
                {
                    if (((CheckBox) parContainer.Controls[i]).Checked)
                    {
                        ((CheckBox) parContainer.Controls[i]).Checked = false;
                    }
                    else
                    {
                        ((CheckBox) parContainer.Controls[i]).Checked = true;
                    }
                }
            }
        }

        private void btn_AllSelect_Click(object sender, EventArgs e)
        {
            if (this.table_AllPople.SelectedIndex == 0)
            {
                this.AllSelectCheck(this.tab_Menu);
            }
            if (this.table_AllPople.SelectedIndex == 1)
            {
                this.AllSelectCheck(this.tab_Pope);
            }
        }

        private void btn_Close_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        private void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable list;
                UserEnt loginUser;
                this.getAllSelect(this.tab_Menu);
                this.getAllSelect(this.tab_Pope);
                string str = "";
                string str2 = "";
                foreach (object obj2 in this.menuTable)
                {
                    str = str + obj2.ToString() + "$(1)|";
                }
                foreach (object obj2 in this.popeTable)
                {
                    str2 = str2 + obj2.ToString().Replace("CPop_", "") + "$(1)|";
                }
                if ((this.RoleId != "") && (str2 != ""))
                {
                    RolePopedomEnt ent2;
                    list = RolePopedomBll.GetList("roleid=" + this.RoleId);
                    loginUser = PublicAppliction.LoginUser;
                    if (list.Rows.Count <= 0)
                    {
                        ent2 = new RolePopedomEnt {
                            RoleId = int.Parse(this.RoleId),
                            ChainNum = loginUser.ChainNum,
                            PopedomValue = str2
                        };
                        RolePopedomBll.Add(ent2);
                    }
                    else
                    {
                        ent2 = new RolePopedomEnt {
                            PopedomValue = str2,
                            RoleId = int.Parse(this.RoleId),
                            ChainNum = loginUser.ChainNum,
                            RolePopedomId = int.Parse(list.Rows[0]["RolePopedomId"].ToString())
                        };
                        RolePopedomBll.Update(ent2);
                    }
                }
                if ((this.RoleId != "") && (str != ""))
                {
                    MenuLinkRoleEnt ent3;
                    list = MenuLinkRoleBll.GetList("roleid=" + this.RoleId);
                    loginUser = PublicAppliction.LoginUser;
                    if (list.Rows.Count > 0)
                    {
                        ent3 = new MenuLinkRoleEnt {
                            MenuLinkId = int.Parse(list.Rows[0]["MenuLinkId"].ToString()),
                            ChainNum = loginUser.ChainNum,
                            MenuLinkValue = str,
                            RoleId = int.Parse(this.RoleId)
                        };
                        MenuLinkRoleBll.Update(ent3);
                    }
                    else
                    {
                        ent3 = new MenuLinkRoleEnt {
                            RoleId = int.Parse(this.RoleId),
                            MenuLinkValue = str,
                            ChainNum = loginUser.ChainNum
                        };
                        MenuLinkRoleBll.Add(ent3);
                    }
                }
                RoleEnt model = RoleBll.GetModel(int.Parse(this.RoleId));
                FrmPrompt prompt = new FrmPrompt(true, "角色权限修改成功");
                WorkLogBll.AddNewLog(model.RoleName + " 角色权限修改成功", "FrmRolePopedom", PublicAppliction.LoginUser);
                base.DialogResult = DialogResult.OK;
                base.Close();
            }
            catch (Exception exception)
            {
                ErrorsBll.NewException(exception, PublicAppliction.LoginUser);
            }
        }

        private bool CheckIsOneUse(string menuName)
        {
            if (menuName == "帮助")
            {
                return false;
            }
            return true;
        }

        private bool checkJionMenu(string MenuId)
        {
            if (this.config.IsUseMeUse == 1)
            {
                return true;
            }
            if (this.hash != null)
            {
                foreach (object obj2 in this.hash)
                {
                    menulue menulue = (menulue) obj2;
                    if (menulue.MenuId == MenuId)
                    {
                        return (menulue.IsUseMenu == "1");
                    }
                }
            }
            return false;
        }

        private bool CheckUseRolePop(string PopId)
        {
            if (this.config.IsUseMeUse == 1)
            {
                return true;
            }
            foreach (object obj2 in this.PopList)
            {
                poplue poplue = (poplue) obj2;
                if (poplue.PopId == PopId)
                {
                    return (poplue.IsUsePop == "1");
                }
            }
            return false;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        protected void Form_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.Control && (e.KeyCode == Keys.S)) && (MessageBox.Show("您确定要保存吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK))
            {
                this.btn_Save_Click(null, null);
            }
        }

        private void getAllSelect(Control parContainer)
        {
            for (int i = 0; i < parContainer.Controls.Count; i++)
            {
                if (parContainer.Controls[i].HasChildren)
                {
                    this.getAllSelect(parContainer.Controls[i]);
                }
                else if (parContainer.Controls[i].GetType().Name == "CheckBox")
                {
                    CheckBox box = (CheckBox) parContainer.Controls[i];
                    if (box.Checked)
                    {
                        string str;
                        int index = box.Name.IndexOf("ZMenu_");
                        if (index >= 0)
                        {
                            str = box.Name.Remove(0, index + 6);
                            this.menuTable.Add(str);
                        }
                        if (box.Name.LastIndexOf("CPop_") >= 0)
                        {
                            str = box.Name.Remove(0, index + 5);
                            this.popeTable.Add(str);
                        }
                    }
                }
            }
        }

        private void GetLoadPopedom()
        {
            UserEnt loginUser = PublicAppliction.LoginUser;
            DataTable list = RolePopedomBll.GetList("chainnum=" + loginUser.ChainNum);
            if (list.Rows.Count > 0)
            {
                string[] strArray = list.Rows[0]["PopedomValue"].ToString().Split(new char[] { '|' });
                int length = 0;
                foreach (string str2 in strArray)
                {
                    if (str2 != "")
                    {
                        Exception exception;
                        string str3 = str2;
                        poplue poplue = new poplue();
                        try
                        {
                            length = str2.IndexOf("$");
                            poplue.PopId = str2.Substring(0, length);
                            str3 = str3.Remove(0, length + 2);
                        }
                        catch (Exception exception1)
                        {
                            exception = exception1;
                        }
                        try
                        {
                            length = str3.IndexOf(")");
                            poplue.IsUsePop = str3.Substring(0, length);
                        }
                        catch (Exception exception2)
                        {
                            exception = exception2;
                        }
                        this.PopList.Add(poplue);
                    }
                }
            }
        }

        private void GetLoginRole()
        {
            if (this.RoleId != "")
            {
                DataTable list = MenuLinkRoleBll.GetList("RoleId=" + this.RoleId);
                if (list.Rows.Count > 0)
                {
                    string[] strArray = list.Rows[0]["MenuLinkValue"].ToString().Split(new char[] { '|' });
                    int length = 0;
                    foreach (string str2 in strArray)
                    {
                        menulue menulue = new menulue();
                        if (str2 != "")
                        {
                            Exception exception;
                            string str3 = str2;
                            try
                            {
                                length = str2.IndexOf("$");
                                menulue.MenuId = str3.Substring(0, length);
                                str3 = str3.Remove(0, length + 2);
                            }
                            catch (Exception exception1)
                            {
                                exception = exception1;
                            }
                            try
                            {
                                length = str3.IndexOf(")");
                                menulue.IsUseMenu = str3.Substring(0, length);
                            }
                            catch (Exception exception2)
                            {
                                exception = exception2;
                            }
                            this.hash.Add(menulue);
                        }
                    }
                }
            }
        }

        private void InitializeComponent()
        {
            this.pan_ZhongJian = new Panel();
            this.lblTitle = new Label();
            this.pan_TopRight = new Panel();
            this.pan_DockLeft = new Panel();
            this.pan_Dock = new Panel();
            this.pan_AllPanel = new Panel();
            this.pan_AllPlanes = new Panel();
            this.pan_AllPope = new Panel();
            this.table_AllPople = new TabControl();
            this.tab_Menu = new TabPage();
            this.tab_Pope = new TabPage();
            this.panel_Button = new Panel();
            this.lbl_TiShi2 = new Label();
            this.btn_AllSelect = new Button();
            this.btn_Close = new Button();
            this.btn_Save = new Button();
            this.panel9 = new Panel();
            this.pan_Rights = new Panel();
            this.pan_Lefts = new Panel();
            this.pan_Bottoms = new Panel();
            this.pane_TopT = new Panel();
            this.pan_DockBottom = new Panel();
            this.pan_DockRight = new Panel();
            this.pan_Top = new Panel();
            this.pan_TopLeft = new Panel();
            this.pan_ZhongJian.SuspendLayout();
            this.pan_Dock.SuspendLayout();
            this.pan_AllPanel.SuspendLayout();
            this.pan_AllPlanes.SuspendLayout();
            this.pan_AllPope.SuspendLayout();
            this.table_AllPople.SuspendLayout();
            this.panel_Button.SuspendLayout();
            this.pan_Top.SuspendLayout();
            base.SuspendLayout();
            this.pan_ZhongJian.BackgroundImage = Resources.uc_title_2;
            this.pan_ZhongJian.Controls.Add(this.lblTitle);
            this.pan_ZhongJian.Dock = DockStyle.Fill;
            this.pan_ZhongJian.Location = new Point(0x1f, 0);
            this.pan_ZhongJian.Name = "pan_ZhongJian";
            this.pan_ZhongJian.Size = new Size(0x39c, 0x20);
            this.pan_ZhongJian.TabIndex = 2;
            this.pan_ZhongJian.MouseDown += new MouseEventHandler(this.pan_ZhongJian_MouseDown);
            this.lblTitle.AutoSize = true;
            this.lblTitle.BackColor = Color.FromArgb(0, 0, 15, 0xff);
            this.lblTitle.Font = new Font("宋体", 9.75f, FontStyle.Bold, GraphicsUnit.Point, 0x86);
            this.lblTitle.ForeColor = Color.FromArgb(0x3b, 0x56, 20);
            this.lblTitle.Location = new Point(6, 8);
            this.lblTitle.Name = "lblTitle";
            this.lblTitle.Size = new Size(0x3f, 13);
            this.lblTitle.TabIndex = 0;
            this.lblTitle.Text = "权限设置";
            this.pan_TopRight.BackgroundImage = Resources.uc_title_1;
            this.pan_TopRight.Dock = DockStyle.Right;
            this.pan_TopRight.Location = new Point(0x3bb, 0);
            this.pan_TopRight.Name = "pan_TopRight";
            this.pan_TopRight.Size = new Size(5, 0x20);
            this.pan_TopRight.TabIndex = 1;
            this.pan_DockLeft.BackColor = Color.FromArgb(0xaf, 0xbf, 190);
            this.pan_DockLeft.Dock = DockStyle.Left;
            this.pan_DockLeft.Location = new Point(0, 0);
            this.pan_DockLeft.Name = "pan_DockLeft";
            this.pan_DockLeft.Size = new Size(1, 0x286);
            this.pan_DockLeft.TabIndex = 0;
            this.pan_Dock.BackColor = Color.FromArgb(0, 0, 15, 0xff);
            this.pan_Dock.Controls.Add(this.pan_AllPanel);
            this.pan_Dock.Controls.Add(this.pan_DockBottom);
            this.pan_Dock.Controls.Add(this.pan_DockRight);
            this.pan_Dock.Controls.Add(this.pan_DockLeft);
            this.pan_Dock.Dock = DockStyle.Fill;
            this.pan_Dock.Location = new Point(0, 0x20);
            this.pan_Dock.Name = "pan_Dock";
            this.pan_Dock.Size = new Size(960, 0x286);
            this.pan_Dock.TabIndex = 5;
            this.pan_AllPanel.BackColor = Color.White;
            this.pan_AllPanel.Controls.Add(this.pan_AllPlanes);
            this.pan_AllPanel.Controls.Add(this.pan_Rights);
            this.pan_AllPanel.Controls.Add(this.pan_Lefts);
            this.pan_AllPanel.Controls.Add(this.pan_Bottoms);
            this.pan_AllPanel.Controls.Add(this.pane_TopT);
            this.pan_AllPanel.Dock = DockStyle.Fill;
            this.pan_AllPanel.Location = new Point(1, 0);
            this.pan_AllPanel.Name = "pan_AllPanel";
            this.pan_AllPanel.Size = new Size(0x3be, 0x285);
            this.pan_AllPanel.TabIndex = 3;
            this.pan_AllPlanes.Controls.Add(this.pan_AllPope);
            this.pan_AllPlanes.Controls.Add(this.panel_Button);
            this.pan_AllPlanes.Controls.Add(this.panel9);
            this.pan_AllPlanes.Dock = DockStyle.Fill;
            this.pan_AllPlanes.Location = new Point(10, 10);
            this.pan_AllPlanes.Name = "pan_AllPlanes";
            this.pan_AllPlanes.Size = new Size(0x3aa, 0x271);
            this.pan_AllPlanes.TabIndex = 4;
            this.pan_AllPope.Controls.Add(this.table_AllPople);
            this.pan_AllPope.Dock = DockStyle.Fill;
            this.pan_AllPope.Location = new Point(0, 0);
            this.pan_AllPope.Name = "pan_AllPope";
            this.pan_AllPope.Size = new Size(0x3aa, 0x241);
            this.pan_AllPope.TabIndex = 7;
            this.table_AllPople.Controls.Add(this.tab_Menu);
            this.table_AllPople.Controls.Add(this.tab_Pope);
            this.table_AllPople.Dock = DockStyle.Fill;
            this.table_AllPople.Location = new Point(0, 0);
            this.table_AllPople.Name = "table_AllPople";
            this.table_AllPople.SelectedIndex = 0;
            this.table_AllPople.Size = new Size(0x3aa, 0x241);
            this.table_AllPople.TabIndex = 0;
            this.tab_Menu.Location = new Point(4, 0x15);
            this.tab_Menu.Name = "tab_Menu";
            this.tab_Menu.Padding = new Padding(3);
            this.tab_Menu.Size = new Size(930, 0x228);
            this.tab_Menu.TabIndex = 0;
            this.tab_Menu.Text = "菜单";
            this.tab_Menu.UseVisualStyleBackColor = true;
            this.tab_Pope.Location = new Point(4, 0x15);
            this.tab_Pope.Name = "tab_Pope";
            this.tab_Pope.Padding = new Padding(3);
            this.tab_Pope.Size = new Size(930, 0x228);
            this.tab_Pope.TabIndex = 1;
            this.tab_Pope.Text = "权限";
            this.tab_Pope.UseVisualStyleBackColor = true;
            this.panel_Button.Controls.Add(this.lbl_TiShi2);
            this.panel_Button.Controls.Add(this.btn_AllSelect);
            this.panel_Button.Controls.Add(this.btn_Close);
            this.panel_Button.Controls.Add(this.btn_Save);
            this.panel_Button.Dock = DockStyle.Bottom;
            this.panel_Button.Location = new Point(0, 0x241);
            this.panel_Button.Name = "panel_Button";
            this.panel_Button.Size = new Size(0x3aa, 0x2b);
            this.panel_Button.TabIndex = 6;
            this.panel_Button.Paint += new PaintEventHandler(this.panel_Button_Paint);
            this.lbl_TiShi2.AutoSize = true;
            this.lbl_TiShi2.Location = new Point(0x2cd, 15);
            this.lbl_TiShi2.Name = "lbl_TiShi2";
            this.lbl_TiShi2.Size = new Size(0xcb, 12);
            this.lbl_TiShi2.TabIndex = 0x10;
            this.lbl_TiShi2.Text = "使用小技巧: Ctrl+S 快速保存 记录.";
            this.btn_AllSelect.Location = new Point(0x1b0, 10);
            this.btn_AllSelect.Name = "btn_AllSelect";
            this.btn_AllSelect.Size = new Size(0x4b, 0x17);
            this.btn_AllSelect.TabIndex = 7;
            this.btn_AllSelect.Text = "全 选";
            this.btn_AllSelect.UseVisualStyleBackColor = true;
            this.btn_AllSelect.Click += new EventHandler(this.btn_AllSelect_Click);
            this.btn_Close.Location = new Point(590, 10);
            this.btn_Close.Name = "btn_Close";
            this.btn_Close.Size = new Size(0x4b, 0x17);
            this.btn_Close.TabIndex = 6;
            this.btn_Close.Text = "关 闭";
            this.btn_Close.UseVisualStyleBackColor = true;
            this.btn_Close.Click += new EventHandler(this.btn_Close_Click);
            this.btn_Save.Location = new Point(0x112, 10);
            this.btn_Save.Name = "btn_Save";
            this.btn_Save.Size = new Size(0x4b, 0x17);
            this.btn_Save.TabIndex = 5;
            this.btn_Save.Text = "保 存";
            this.btn_Save.UseVisualStyleBackColor = true;
            this.btn_Save.Click += new EventHandler(this.btn_Save_Click);
            this.panel9.Dock = DockStyle.Bottom;
            this.panel9.Location = new Point(0, 620);
            this.panel9.Name = "panel9";
            this.panel9.Size = new Size(0x3aa, 5);
            this.panel9.TabIndex = 3;
            this.pan_Rights.Dock = DockStyle.Right;
            this.pan_Rights.Location = new Point(0x3b4, 10);
            this.pan_Rights.Name = "pan_Rights";
            this.pan_Rights.Size = new Size(10, 0x271);
            this.pan_Rights.TabIndex = 3;
            this.pan_Lefts.Dock = DockStyle.Left;
            this.pan_Lefts.Location = new Point(0, 10);
            this.pan_Lefts.Name = "pan_Lefts";
            this.pan_Lefts.Size = new Size(10, 0x271);
            this.pan_Lefts.TabIndex = 2;
            this.pan_Bottoms.Dock = DockStyle.Bottom;
            this.pan_Bottoms.Location = new Point(0, 0x27b);
            this.pan_Bottoms.Name = "pan_Bottoms";
            this.pan_Bottoms.Size = new Size(0x3be, 10);
            this.pan_Bottoms.TabIndex = 1;
            this.pane_TopT.Dock = DockStyle.Top;
            this.pane_TopT.Location = new Point(0, 0);
            this.pane_TopT.Name = "pane_TopT";
            this.pane_TopT.Size = new Size(0x3be, 10);
            this.pane_TopT.TabIndex = 0;
            this.pan_DockBottom.BackColor = Color.FromArgb(0xaf, 0xbf, 190);
            this.pan_DockBottom.Dock = DockStyle.Bottom;
            this.pan_DockBottom.Location = new Point(1, 0x285);
            this.pan_DockBottom.Name = "pan_DockBottom";
            this.pan_DockBottom.Size = new Size(0x3be, 1);
            this.pan_DockBottom.TabIndex = 2;
            this.pan_DockRight.BackColor = Color.FromArgb(0xaf, 0xbf, 190);
            this.pan_DockRight.Dock = DockStyle.Right;
            this.pan_DockRight.Location = new Point(0x3bf, 0);
            this.pan_DockRight.Name = "pan_DockRight";
            this.pan_DockRight.Size = new Size(1, 0x286);
            this.pan_DockRight.TabIndex = 1;
            this.pan_Top.Controls.Add(this.pan_ZhongJian);
            this.pan_Top.Controls.Add(this.pan_TopRight);
            this.pan_Top.Controls.Add(this.pan_TopLeft);
            this.pan_Top.Dock = DockStyle.Top;
            this.pan_Top.Location = new Point(0, 0);
            this.pan_Top.Name = "pan_Top";
            this.pan_Top.Size = new Size(960, 0x20);
            this.pan_Top.TabIndex = 4;
            this.pan_TopLeft.BackgroundImage = Resources.uc_title;
            this.pan_TopLeft.Dock = DockStyle.Left;
            this.pan_TopLeft.Location = new Point(0, 0);
            this.pan_TopLeft.Name = "pan_TopLeft";
            this.pan_TopLeft.Size = new Size(0x1f, 0x20);
            this.pan_TopLeft.TabIndex = 0;
            this.pan_TopLeft.MouseDown += new MouseEventHandler(this.pan_TopLeft_MouseDown);
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(960, 0x2a6);
            base.Controls.Add(this.pan_Dock);
            base.Controls.Add(this.pan_Top);
            base.FormBorderStyle = FormBorderStyle.None;
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "FrmRolePopedom";
            base.ShowIcon = false;
            this.pan_ZhongJian.ResumeLayout(false);
            this.pan_ZhongJian.PerformLayout();
            this.pan_Dock.ResumeLayout(false);
            this.pan_AllPanel.ResumeLayout(false);
            this.pan_AllPlanes.ResumeLayout(false);
            this.pan_AllPope.ResumeLayout(false);
            this.table_AllPople.ResumeLayout(false);
            this.panel_Button.ResumeLayout(false);
            this.panel_Button.PerformLayout();
            this.pan_Top.ResumeLayout(false);
            base.ResumeLayout(false);
        }

        private void LoadChildMenu(Panel panel, string menuId, DataTable MenuTable)
        {
            string filterExpression = "";
            filterExpression = " MenuSId='" + menuId + "' and ISFMenu=0";
            int num = 0;
            DataRow[] rowArray = MenuTable.Select(filterExpression, "MenuTaxisNum");
            int x = 120;
            foreach (DataRow row in rowArray)
            {
                if (this.CheckIsOneUse(row["MenuName"].ToString()))
                {
                    CheckBox box = new CheckBox {
                        Name = "chk_ZMenu_" + row["MenuId"].ToString(),
                        Text = row["MenuName"].ToString()
                    };
                    if (this.checkJionMenu(row["MenuId"].ToString()))
                    {
                        box.Checked = true;
                    }
                    box.Location = new Point(x, 5);
                    box.Size = new Size(100, 20);
                    panel.Controls.Add(box);
                    x += 0x69;
                    num++;
                }
            }
        }

        private void LoadMenu()
        {
            DataTable list = MenuListBll.GetList("");
            string filterExpression = "ISFMenu=1";
            DataRow[] rowArray = list.Select(filterExpression, "MenuTaxisNum");
            int num = 0;
            foreach (DataRow row in rowArray)
            {
                if (this.CheckIsOneUse(row["MenuName"].ToString()))
                {
                    Panel panel = new Panel {
                        Name = "pan_ZMenu" + num
                    };
                    CheckBox box = new CheckBox {
                        Name = "chk_ZMenu_" + row["MenuId"].ToString(),
                        Text = row["MenuName"].ToString()
                    };
                    if (this.checkJionMenu(row["MenuId"].ToString()))
                    {
                        box.Checked = true;
                    }
                    panel.Dock = DockStyle.Top;
                    panel.Size = new Size(this.tab_Menu.Width, 0x19);
                    box.Location = new Point(15, 5);
                    box.Size = new Size(100, 20);
                    panel.Controls.Add(box);
                    this.LoadChildMenu(panel, row["MenuId"].ToString(), list);
                    this.tab_Menu.Controls.Add(panel);
                }
                num++;
            }
        }

        private void LoadRolePople()
        {
            DataTable list = new DataTable();
            list = PopedomTempBll.GetList("IsSuperPop=0");
            int num = 0;
            foreach (DataRow row in list.Rows)
            {
                if (row["IsPopUse"].ToString() == "1")
                {
                    Panel panel = new Panel {
                        Name = "pan_ZPop" + num
                    };
                    Label label = new Label {
                        Name = "lbl_ZPop_" + row["PopTempId"].ToString(),
                        Text = row["PopTempName"].ToString()
                    };
                    panel.Dock = DockStyle.Top;
                    panel.Size = new Size(this.tab_Menu.Width, 0x19);
                    label.Location = new Point(15, 10);
                    label.Size = new Size(100, 0x19);
                    label.AutoSize = true;
                    panel.Controls.Add(label);
                    this.LoadSPopdom(row["PopTempId"].ToString(), panel);
                    this.tab_Pope.Controls.Add(panel);
                    num++;
                }
            }
        }

        private void LoadSPopdom(string PopTempId, Panel panel)
        {
            DataTable list = new DataTable();
            list = PopdomValueBll.GetList("PopTempId=" + PopTempId);
            int x = 120;
            int num2 = 0;
            foreach (DataRow row in list.Rows)
            {
                if (row["PopdomName"].ToString() != "")
                {
                    CheckBox box = new CheckBox {
                        Name = "chk_CPop_" + row["PopdomId"].ToString(),
                        Text = row["PopdomName"].ToString()
                    };
                    if (this.CheckUseRolePop(row["PopdomId"].ToString()))
                    {
                        box.Checked = true;
                    }
                    box.Location = new Point(x, 6);
                    box.Size = new Size(100, 20);
                    panel.Controls.Add(box);
                    x += 0x69;
                    num2++;
                }
            }
        }

        private void pan_TopLeft_MouseDown(object sender, MouseEventArgs e)
        {
            ReleaseCapture();
            SendMessage(base.Handle, 0x112, 0xf012, 0);
        }

        private void pan_ZhongJian_MouseDown(object sender, MouseEventArgs e)
        {
            ReleaseCapture();
            SendMessage(base.Handle, 0x112, 0xf012, 0);
        }

        private void panel_Button_Paint(object sender, PaintEventArgs e)
        {
            this.Panel_ResetPaint(e, this.panel_Button, Color.FromArgb(0xca, 0xc9, 0xce), 1, 1, 1, 1);
        }

        private void Panel_ResetPaint(PaintEventArgs e, Panel panel, Color color, int leftBoder, int topBoder, int rightBoder, int bottomBoder)
        {
            ControlPaint.DrawBorder(e.Graphics, panel.ClientRectangle, color, leftBoder, ButtonBorderStyle.Solid, color, topBoder, ButtonBorderStyle.Solid, color, rightBoder, ButtonBorderStyle.Solid, color, bottomBoder, ButtonBorderStyle.Solid);
        }

        [DllImport("user32.dll")]
        public static extern bool ReleaseCapture();
        [DllImport("user32.dll")]
        public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
    }
}

